package com.angel.interfaces;

import com.angel.application.commandgateways.RegisterCommandService;
import com.angel.application.commandgateways.commands.RegisterCommand;
import com.angel.infrastructure.common.ResultBody;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 授权 登录 注册
 */
@RestController
@RequestMapping("/auth")
public class AuthController {

    private final RegisterCommandService registerCommandService;

    public AuthController(RegisterCommandService registerCommandService) {
        this.registerCommandService = registerCommandService;
    }

    @PostMapping(value = "/register")
    public ResultBody register(@RequestBody RegisterCommand registerCommand) {
        registerCommandService.register(registerCommand);
        return ResultBody.SUCCESS;
    }

}
